﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:AdminApi="clr-namespace:Microsoft.ApplicationServer.Caching.AdminApi;assembly=Microsoft.ApplicationServer.Caching.Management" 
    xmlns:MDCAdminTool="clr-namespace:MDCAdminTool;assembly=E4D.AppFabric.Entities" >

   <ResourceDictionary.MergedDictionaries>
      <ResourceDictionary Source="Images.xaml" />   
   </ResourceDictionary.MergedDictionaries>

   <HierarchicalDataTemplate DataType="{x:Type MDCAdminTool:CacheRegion}" ItemsSource="{Binding CacheItems}">
      <StackPanel Orientation="Horizontal">
         <Image Source="..\Resources\Region.png" Height="16" Width="16"  Margin="0,0,3,0"/>
         <TextBlock>
            Region: <TextBlock Text="{Binding Name}" FontWeight="Bold"/>
         <TextBlock.ContextMenu>
               <ContextMenu>                 
                  <MenuItem Header="Remove Cache Region" Command="{StaticResource RemoveRegionCacheName}" CommandParameter="{Binding}" Icon="{StaticResource RemoveCache16}"/>                   
                  <MenuItem Header="Add Cache Region"    Command="{StaticResource AddRegionCacheName}"    CommandParameter="{Binding}" Icon="{StaticResource AddRegionCacheName16}"/>
               </ContextMenu>
            </TextBlock.ContextMenu>
         </TextBlock>
      </StackPanel>
   </HierarchicalDataTemplate>

   <DataTemplate x:Key="CacheRegionContentTemplate" 
                 DataType="{x:Type MDCAdminTool:CacheRegion}">
      <GroupBox Padding="15">
         <ScrollViewer>
            <Grid>
               <Grid.RowDefinitions>
                  <RowDefinition Height="30*" />
                  <RowDefinition Height="200*" />
                  <RowDefinition Height="30*" />
               </Grid.RowDefinitions>

               <StackPanel x:Name="spTitle" Grid.Row="0" Orientation="Horizontal" Margin="15,0,0,0">
                  <StaticResource ResourceKey="RegionCacheName"/>
                  <TextBlock Text="{Binding Name}" FontSize="32" FontWeight="Bold" Margin="15,0,0,0" />
                  <TextBlock x:Name="HeaderText" Text=" Region" FontSize="32" FontWeight="Bold" />
               </StackPanel>

               <StackPanel Grid.Row="1" Margin="15">
                  <GroupBox Padding="15" Margin="0,0,0,25">
                     <GroupBox.Header>
                        <StackPanel Orientation="Horizontal">
                           <StaticResource ResourceKey="GetHostConfig16" />
                           <TextBlock Text="Cache Name Config" Margin="5,0,0,0"/>
                        </StackPanel>
                     </GroupBox.Header>
                     <Grid >

                        <Grid.ColumnDefinitions>
                           <ColumnDefinition Width="Auto" />
                           <ColumnDefinition Width="Auto" />
                           <ColumnDefinition Width="Auto" />
                           <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                           <RowDefinition Height="Auto" />
                           <RowDefinition Height="Auto" />
                           <RowDefinition Height="Auto" />
                           <RowDefinition Height="Auto" />
                           <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <Label Content="Name:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <TextBox Grid.Column="1" Grid.Row="0" IsReadOnly="True" Height="23" HorizontalAlignment="Left" Margin="3" Name="nameTextBox" Text="{Binding Path=Name}" VerticalAlignment="Center" Width="120" />

                        <Label Content="Role:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <TextBox Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="3" Name="evictionTextBox" Text="{Binding Path=Role}" VerticalAlignment="Center" Width="120" />

                        <Label Content="Port:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <TextBox Grid.Column="1" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="3" Name="tTLTextBox" Text="{Binding Path=PortNo}" VerticalAlignment="Center" Width="120" />

                       
                     </Grid>
                  </GroupBox>

                  <GroupBox Padding="15">
                     <GroupBox.Header>
                        <StackPanel Orientation="Horizontal">
                           <StaticResource ResourceKey="CacheHostStatistics16" />
                           <TextBlock Text="Cache Name Stats" Margin="5,0,0,0"/>
                        </StackPanel>
                     </GroupBox.Header>
                     <Grid >

                        <Grid.ColumnDefinitions>
                           <ColumnDefinition Width="Auto" />
                           <ColumnDefinition Width="Auto" />
                           <ColumnDefinition Width="Auto" />
                           <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                           <RowDefinition Height="Auto" />
                           <RowDefinition Height="Auto" />
                           <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <Label Content="Item Count:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <TextBox Grid.Column="1" Grid.Row="0" Height="23" HorizontalAlignment="Left" Margin="3" Name="itemCountTextBox" Text="{Binding Path=CacheRegionStats.ItemCount}" VerticalAlignment="Center" Width="120" />
                        <Label Content="Miss Count:" Grid.Column="2" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <TextBox Grid.Column="3" Grid.Row="0" Height="23" HorizontalAlignment="Left" Margin="3" Name="missCountTextBox" Text="{Binding Path=CacheRegionStats.MissCount}" VerticalAlignment="Center" Width="120" />

                        <Label Content="Region Name:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <TextBox Grid.Column="1" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="3" Name="regionCountTextBox" Text="{Binding Path=CacheRegionStats.RegionName}" VerticalAlignment="Center" Width="120" />
                        <Label Content="Request Count:" Grid.Column="2" Grid.Row="1" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <TextBox Grid.Column="3" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="3" Name="requestCountTextBox" Text="{Binding Path=CacheRegionStats.RequestCount}" VerticalAlignment="Center" Width="120" />

                        <Label Content="Size:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
                        <TextBox Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="3" Name="sizeTextBox" Text="{Binding Path=CacheRegionStats.Size}" VerticalAlignment="Center" Width="120" />

                     </Grid>
                  </GroupBox>
               </StackPanel>



               <StackPanel x:Name="spFooter" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,15,0">
                        <Button Height="23" Width="75" Margin="5,0,5,0" Content="Cancel" Command="{StaticResource TabClose}"/>
                  <Button Height="23" Width="75" Margin="5,0,5,0" Content="Save" Command="{StaticResource SaveCacheName}" CommandParameter="{Binding}"/>
               </StackPanel>
            </Grid>
         </ScrollViewer>
      </GroupBox>
   </DataTemplate>

    <!--<DataTemplate DataType="{x:Type AdminApi:Microsoft.ApplicationServer.Caching.AdminApi.RegionInfo}" >
        <StackPanel Orientation="Horizontal">
            
            <TextBlock Text="Host Name:" Margin="5,0,10,0"/>
            <TextBlock Text="{Binding HostName }" FontWeight="Bold" Margin="5,0,10,0"/>

            <TextBlock Text="Cache Name:" Margin="5,0,10,0"/>
            <TextBlock Text="{Binding CacheName }" FontWeight="Bold" Margin="5,0,10,0"/>

            <TextBlock Text="Port No:" Margin="5,0,10,0"/>
            <TextBlock Text="{Binding PortNo }" FontWeight="Bold" Margin="5,0,10,0"/>

            <TextBlock Text="Region Name:" Margin="5,0,10,0"/>
            <TextBlock Text="{Binding RegionName }" FontWeight="Bold" Margin="5,0,10,0"/>

            <TextBlock Text="Role:" Margin="5,0,10,0"/>
            <TextBlock Text="{Binding Role }" FontWeight="Bold" Margin="5,0,10,0"/>

        </StackPanel>
    </DataTemplate>-->

</ResourceDictionary>